package com.sharp.demo.dao.entity;

import com.sharp.authorization.dao.common.entity.AcUser;
import com.sharp.authorization.dao.common.entity.AcUserRole;
import com.sharp.kernel.mybatis.join.entity.IOutJoinRelationship;
import com.sharp.kernel.mybatis.join.entity.JoinRelationship;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;

/**
 * Title: UserWithRoleId
 * Description: Copyright: Copyright (c) 2019 Company: BHFAE
 *
 * @author Sharp
 * @date 2022/7/26 16:14
 */

@Data
@EqualsAndHashCode(callSuper = true)
public class UserWithRoleId extends AcUser implements IOutJoinRelationship {

    /**
     * 用户ID
     */
    @Column(name = "ac_user_role.user_id")
    @ApiModelProperty(value = "用户ID")
    private String userId;

    /**
     * 角色ID
     */
    @Column(name = "ac_user_role.role_id")
    @ApiModelProperty(value = "角色ID")
    private String roleId;

    @Override
    public JoinRelationship joinRelationship() {
        return buildJoinRelationship(AcUser.class, "id", AcUserRole.class, "userId");
    }
}
